<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
    <title>微信支付</title>
    
</head>
<body>
    <br/>
		<button style="width:210px; height:50px; border-radius: 25px;background-color:#FE6714; border:0px #ff6600 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" id="callpay" >立即支付</button>
	</div>
</body>
<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    
    $(document).ready(function(){
        // $("#callpay").click();
        var ref = setInterval(function(){
            var trade = "{$pay_order.order_sn}";
            alert(trade)
            $.get("/BfcTyWlLqd.php/vxpay/pay/check_outtrade",{trade:trade},function(data){
                var obj = jQuery.parseJSON(data);
                if(obj.code == 1){
                     clearInterval(ref);
                     WeixinJSBridge.call("closeWindow");
                }
            });
        }, 1000)
        // setTimeout(function(){
        //     WeixinJSBridge.call("closeWindow");
        // },3000);
    })
</script>
</html>